package logic

import (
	"context"
	"zye1/user_srv/model/mysql"

	"zye1/user_srv/internal/svc"
	"zye1/user_srv/user"

	"github.com/zeromicro/go-zero/core/logx"
)

type RegisterCodeUserLogic struct {
	ctx    context.Context
	svcCtx *svc.ServiceContext
	logx.Logger
}

func NewRegisterCodeUserLogic(ctx context.Context, svcCtx *svc.ServiceContext) *RegisterCodeUserLogic {
	return &RegisterCodeUserLogic{
		ctx:    ctx,
		svcCtx: svcCtx,
		Logger: logx.WithContext(ctx),
	}
}

func (l *RegisterCodeUserLogic) RegisterCodeUser(in *user.RegisterCodeUserRequest) (*user.RegisterCodeUserResponse, error) {
	// todo: 短信账号密码注册

	u := mysql.UserZye1{}

	err := u.RegisterByMobileUser()
	if err != nil {
		logx.Error("用户注册失败", err)
		return nil, err
	}

	return &user.RegisterCodeUserResponse{}, nil
}
